#include <iostream>
#include <string>
using namespace std;

bool judge(char x, char y)
{
    if (x == y)
        return true;
    if (x + 32 == y || x - 32 == y)
    {
        return true;
    }
    else
    {
        return false;
    }
}

bool judge_chara_num(char c)
{
    if (c < 48 || (c > 57 && c < 65) ||(c>90&&c<97)|| (c > 122))
    {
        return true;
    }
    else
    {
        return false;
    }

}

bool isPalindrome(string s) {
    if (s == " ")
        return true;
    int begin = 0;
    int end = s.size() - 1;
    while (begin <= end)
    {
        while (judge_chara_num(s[begin])&&begin<=(s.size()-1))
        {
            begin++;
            if (begin > (s.size() - 1))
                break;
        }

        while (judge_chara_num(s[end])&&end>=0)
        {
            end--;
            if (end < 0)
                break;
        }

        if (end < 0 || begin >= (s.size() - 1))
        {
            return false;
        }

        if (judge(s[begin], s[end]) == false)
        {
            return false;
        }
        else
        {
            begin++;
            end--;
        }
    }
    return true;

}



int main()
{
   // string s1("race a car");
    string s2 = ("ab_a");

    cout<<isPalindrome(s2);
}
//int main()
//{
////	string s1("hello world");
////	cout << s1.size() << endl;
////	cout << s1.capacity() << endl;
//////	s1.append("dsdaf");
////	cout << s1 << endl;
////	s1.push_back(' ');
////	s1.push_back('a');
////	cout << s1 << endl;
////	s1.clear();
////	cout << s1 << endl;
////	cout << s1.size() << endl;
////	cout << s1.capacity() << endl;
////
////	(char) i = s1[1];
//
//	//char c = '1';
//	//char a = 'a';
//	//char A = 'A';
//	//if (A + 32 == a)
//	//	cout << 1;
//
//
//    cout << judge__chara_num('-');
//}